package org.wak.scene
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	import org.wak.main.AdventureMaster;
	
	/**
	 * The WalkBehindArea is for static object of the Scene.
	 * That has the depth managed. Usually these objects are part of the background
	 * or ambience but not for interaction, they are there just for estetic purposes.
	 * PlayerDisplay's y coordinate. 
	 * 
	 */	
	public class WalkBehindArea extends Sprite implements IManagedDepth
	{
		
		
		// the Y baseline to activate this mask.
		private var mBaseline:int = 0 ;		
		
		
		
		
		/**
		 *  Constructor
		 * @param pXmlInput XML defining the walk behind data.
		 */		
		public function WalkBehindArea(pDef:IWalkbehindDefinition)
		{
			super();
			
			var fDisplay:DisplayObject = new AdventureMaster.Resources[pDef.displayObjectId] as DisplayObject ;
			this.addChild(fDisplay);
			
			this.x = pDef.position.x ;
			this.y = pDef.position.y ;
			
			mBaseline = pDef.baseline ;
			
		}
		
		public function get baseline():int
		{
			return mBaseline ;
		}
		
		public function get displayObject():DisplayObject
		{
			return this ;
		}
		
		
		
		public override function toString():String
		{
			return "WalkBehindArea:"+ mBaseline ;
		}
		
		

		
	}
}